<script setup lang="ts">
import { ref } from 'vue'

const input = ref('')
const isSearchRoute = ref(false)
</script>

<template>
    <div class="search-panel top-ui">
        <div class="searchbox">
            <div class="searchbox-container">
                <el-input class="" v-model="input" placeholder="搜地点、查公交、找路线" clearable />
                <el-tooltip
                    effect="dark"
                    :content="isSearchRoute ? '关闭路线' : '路线'"
                    placement="bottom"
                >
                    <button @click="isSearchRoute = !isSearchRoute" class="searchbox-content-button"
                            :class="{'searchbox-content-button-close':isSearchRoute}"
                    ></button>
                </el-tooltip>
            </div>
            <el-tooltip
                effect="dark"
                content="搜索"
                placement="bottom"
            >
                <!--<Iconfont name="icon-biaomian"></Iconfont>-->
                <button class="search-button" />
            </el-tooltip>
        </div>
    </div>
</template>

<style lang="scss" scoped>
.search-panel {
    right: pxToVw(90);
    top: pxToVw(30);
    width: pxToVw(425);

    .searchbox {
        display: flex;

        // 搜索框
        .searchbox-container {
            display: flex;
            width: 368px;
            background-color: $app-bg-color;

            // 搜索内容
            :deep(.el-input) {

                .el-input__wrapper {
                    padding: 0;
                    border-radius: 0;
                    background-color: $app-bg-color;

                    .el-input__inner {
                        box-sizing: border-box;
                        border: 0;
                        padding: 9px 0;
                        border-left: 10px solid transparent;
                        border-right: 27px solid transparent;
                        line-height: 20px;
                        font-size: 16px;
                        height: 38px;
                        color: $app-font-color;
                        position: relative;
                        border-radius: 2px 0 0 2px;

                        &::placeholder {
                            color: $app-placeholder-color;
                            font-size: 15px;
                        }
                    }
                }
            }

            // 路径搜索按钮
            .searchbox-content-button {
                width: 44px;
                height: 38px;
                padding: 2px;
                border: 0;
                border-top: 1px solid #eee;
                border-bottom: 1px solid #eee;
                border-left: 1px solid #eee;
                cursor: pointer;
                position: relative;
                //background: url("@/assets/images/map/searchbox.png") no-repeat 0 0;
                @include setBackgroundImage("/map/searchbox.png", -2px, -2px);

                &.searchbox-content-button-close {
                    @include setBackgroundImage("/map/searchbox.png", -2px, -40px);
                }
            }
        }

        // 搜索按钮
        .search-button {
            width: 57px;
            height: 38px;
            padding: 0;
            border: 0;
            border-radius: 0 2px 2px 0;
            box-shadow: 1px 2px 1px rgba(0, 0, 0, .15);
            pointer-events: auto;
            font-size: 20px;
            cursor: pointer;
            @include setBackgroundImage("/map/searchbox.png", -4px, -76px);
            background-color: #3385ff;
        }
    }
}
</style>
